﻿using Autodesk.AutoCAD.DatabaseServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DonetArxLib.DoubleClickHandler
{
    public class CustomCommandMappers : Dictionary<Type, ICustomCommandMapper>
    {
        public string GetCustomCommand(ObjectId entId)
        {
            string cmd = null;

            foreach (KeyValuePair<Type, ICustomCommandMapper> item in this)
            {
                ICustomCommandMapper custCommand = item.Value;
                string c = custCommand.GetMappedCustomCommand(entId);
                if (!string.IsNullOrEmpty(c))
                {
                    cmd = c;
                    break; // 找到第一个匹配的命令后退出循环
                }
            }

            return cmd;
        }

    }
}
